package com.ikas.ai.server.security;

/**
 * @author hubowei
 * @email hu.bowei@ikasinfo.com
 * @date 2023-8-29 10:21:57
 */
public class UserContextHolder {

    private static final ThreadLocal<TokenUser> localeThreadLocal = new ThreadLocal<TokenUser>();


    public static void setTokenUser(TokenUser user) {
        if (user != null) {
            localeThreadLocal.set(user);
        }
    }

    public static void removeTokenUser() {
        UserContextHolder.localeThreadLocal.remove();
    }


    public static TokenUser getTokenUser() {
        return localeThreadLocal.get();
    }
}
